import './themes/font.scss';
import './themes/index.scss';

import { createApp } from 'vue';
import { setupRouter } from './routes/router';
import { staticRoutes } from './routes/staticRoutes';
import App from './App.vue';

const app = createApp(App);
const router = setupRouter(staticRoutes);

app.use(router);
app.config.errorHandler = (err, instance, info) => {
  console.error('[SmartPrint Global Error]', err, info);
};

router.isReady().then(() => {
  app.mount('#app').$nextTick(() => {
    postMessage({ payload: 'removeLoading' }, '*');
  });

  // Use contextBridge
  window.ipcRenderer.on('main-process-message', (_event, message) => {
    // eslint-disable-next-line no-console
    console.log(message);
  });
});
